package com.matrix.draft.sockettest.nettychatroom;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

// 敏感字处理Handler
public class ChatSentitiveWordHandler extends SimpleChannelInboundHandler<String> {
    @Override
    protected void channelRead0(ChannelHandlerContext ctx, String msg) {
        msg = msg.replaceAll("尼玛", "**")
                .replaceAll("nm", "**")
                .replaceAll("艹", "*");
        System.err.println("敏感字Handler已完成");
        ctx.fireChannelRead(msg);
    }
}
